/**
 *  Copyright (C) 2008 Richard Hall
 *
 *  This program is free software; you can redistribute it and/or modify it under the terms of the 
 *  GNU General Public License as published by the Free Software Foundation; either version 3 of the 
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
 *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 *  See the GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along with this program; if not, 
 *  see <http://www.gnu.org/licenses>.
 *
 *  Additional permission under GNU GPL version 3 section 7
 *
 *  If you modify this Program, or any covered work, by linking or combining it with [name of library] 
 *  (or a modified version of that library), containing parts covered by the terms of 
 *  [name of library's license], the licensors of this Program grant you additional permission to 
 *  convey the resulting work. {Corresponding Source for a non-source form of such a combination shall 
 *  include the source code for the parts of [name of library] used as well as that of the 
 *  covered work.}
 *
 * 
 */

package com.gpsmedia.dataobject;

import java.util.Calendar;

import com.gpsmedia.dataobject.audio.AudioData;
import com.gpsmedia.dataobject.picture.PictureData;

/**
	 * This class is used to store the data gathered from the GPS Log, pictures
	 * and audio.
	 * 
	 * @author Richard Hall
	 */
public class NmeaData {

    private Calendar date = null;
    

    private int latdeg = 0;
    private int longdeg = 0;
    private double latmins = 0;
    private double longmins = 0;
    private double longdec = 0;
    private double latdec = 0;
    private String latdir = "";
    private String longdir = "";
    private double knotspeed = 0;
    private double direction = 0;
    private boolean stopped = false;
    //new audio stuff

    private AudioData audio = new AudioData();
    private boolean includeInPath = true;
    //VTG data

    private double kmhspeed;
    //GGA data

    private double altitude;
    //GSA data

    private double hdop;
    private double pdop;
    private double vdop;
    // picture data

    private PictureData pictures[] = {new PictureData(), new PictureData(),
            new PictureData(), new PictureData(), new PictureData(), new PictureData(),
            new PictureData(), new PictureData(), new PictureData(), new PictureData()};//new PictureData[10];// = {"","","","","","","","","",""};

    /* (non-Javadoc)
 * @see java.lang.Object#toString()
 */
    @Override
    public String toString() {

        String returnString = "Date= " + getDate().getTime().toString() + "\r\n" +
                "Latitude degress= " + getLatdeg() + "\r\n" +
                "Latitude minutes= " + getLatmins() + "\r\n" +
                "Latitude direction= " + getLatdir() + "\r\n" +
                "Latitude decimal= " + getLatdec() + "\r\n" +
                "Longitude degrees= " + getLongdeg() + "\r\n" +
                "Longitude minutes= " + getLongmins() + "\r\n" +
                "Longitude direction= " + getLongdir() + "\r\n" +
                "Longitude decimal= " + getLongdec() + "\r\n" +
                "Knotspeed= " + getKnotspeed() + "\r\n" +
                "Direction= " + getDirection() + "\r\n" +
                "Stopped= " + isStopped() + "\r\n" +
                "is included in path= " + isIncludeInPath() + "\r\n" +
                "Speed in kmh= " + getKmhspeed() + "\r\n" +
                "Altitude= " + getAltitude() + "\r\n" +
                "HDOP= " + getHdop() + "\r\n" +
                "VDOP= " + getVdop() + "\r\n" +
                "PDOP= " + getPdop() + "\r\n";

        if (getAudio().getPath().compareToIgnoreCase("") != 0) {
            String audioStuff = "Audio Stuff" + "\r\n" +
                    "Audio upload path= " + getAudio().getAudioUploadPath() + "\r\n" +
                    "Audio description= " + getAudio().getDescription() + "\r\n" +
                    "Audio path= " + getAudio().getPath() + "\r\n" +
                    "Audio title= " + getAudio().getTitle() + "\r\n" +
                    "Audio checked= " + getAudio().isChecked() + "\r\n" +
                    "Audio include= " + getAudio().isInclude() + "\r\n";
            returnString = returnString + audioStuff;
        }


        for (int i = 0; i < getPictures().length; i++) {
            if (getPictures()[i].getPath().compareToIgnoreCase("") != 0) {
                String pictureStuff = "Pictures" + "\r\n" +
                        "Picture" + i + "\r\n" +
                        "description= " + getPictures()[i].getDescription() + "\r\n" +
                        "checked= " + getPictures()[i].isChecked() + "\r\n" +
                        "include= " + getPictures()[i].isInclude() + "\r\n" +
                        "path= " + getPictures()[i].getPath() + "\r\n" +
                        "title= " + getPictures()[i].getTitle() + "\r\n" +
                        "upload= " + getPictures()[i].isUpload() + "\r\n" +
                        "upload path= " + getPictures()[i].getUploadPath() + "\r\n";

                returnString = returnString + pictureStuff;
            }
        }



        return returnString;


    }

    /**
	 * This method returns the date field.
	 * 
	 * @return The date field
	 */
    public Calendar getDate() {
        return date;
    }

    /**
	 * Sets the date field
	 * 
	 * @param date
	 *            The date to be set.
	 */
    public void setDate(Calendar date) {
        this.date = date;
    }

    /**
	 * Gets the latitude degrees.
	 * 
	 * @return The latitude degrees
	 */
    public int getLatdeg() {
        return latdeg;
    }

    /**
	 * Sets the latitude degrees.
	 * 
	 * @param latdeg
	 *            The latitude degrees.
	 */
    public void setLatdeg(int latdeg) {
        this.latdeg = latdeg;
    }

    /**
	 * Gets the longitude degrees.
	 * 
	 * @return The longitude degrees.
	 */
    public int getLongdeg() {
        return longdeg;
    }

    /**
	 * Sets the longitude degrees.
	 * 
	 * @param longdeg
	 *            The longitude degrees.
	 */
    public void setLongdeg(int longdeg) {
        this.longdeg = longdeg;
    }


    /**
	 * Gets the latitude minutes.
	 * 
	 * @return The latitude minutes.
	 */
    public double getLatmins() {
        return latmins;
    }

    /**
	 * Sets the latitude minutes.
	 * 
	 * @param latmins
	 *            The latitude minutes.
	 */
    public void setLatmins(double latmins) {
        this.latmins = latmins;
    }

    /**
	 * Gets the longitude minutes.
	 * 
	 * @return The longitude minutes.
	 */
    public double getLongmins() {
        return longmins;
    }

    /**
	 * Sets the longitude minutes.
	 * 
	 * @param longmins
	 *            The longitude minutes.
	 */
    public void setLongmins(double longmins) {
        this.longmins = longmins;
    }

    /**
	 * Gets the longitude decimal.
	 * 
	 * @return The longitude decimal.
	 */
    public double getLongdec() {
        return longdec;
    }

    /**
	 * Sets the longitude decimal.
	 * 
	 * @param longdec
	 *            The longitude decimal.
	 */
    public void setLongdec(double longdec) {
        this.longdec = longdec;
    }

    /**
	 * Gets the latitude decimal.
	 * 
	 * @return The latitude decimal.
	 */
    public double getLatdec() {
        return latdec;
    }

    /**
	 * Sets the latitude decimal.
	 * 
	 * @param latdec
	 *            The latitude decimal.
	 */
    public void setLatdec(double latdec) {
        this.latdec = latdec;
    }

    /**
	 * Returns the latitude direction
	 * 
	 * @return String of either E or W
	 */
    public String getLatdir() {
        return latdir;
    }

    /**
	 * Sets the latitude direction
	 * 
	 * @param latdir
	 *            String of either E or W
	 */
    public void setLatdir(String latdir) {
        this.latdir = latdir;
    }

    /**
	 * Returns the longitude direction
	 * 
	 * @return String of either N or S
	 */
    public String getLongdir() {
        return longdir;
    }

    /**
	 * Sets the longitude direction
	 * 
	 * @param longdir
	 *            String of either N or S
	 */
    public void setLongdir(String longdir) {
        this.longdir = longdir;
    }

    /**
	 * Returns the knot speed
	 * 
	 * @return The knot speed
	 */
    public double getKnotspeed() {
        return knotspeed;
    }

    /**
	 * Sets the knot speed
	 * 
	 * @param knotspeed
	 *            The knot speed
	 */
    public void setKnotspeed(double knotspeed) {
        this.knotspeed = knotspeed;
    }

    /**
	 * Gets the direction that was being moved in.
	 * 
	 * @return The direction
	 */
    public double getDirection() {
        return direction;
    }

    /**
	 * Sets the direction being moved
	 * 
	 * @param direction
	 *            The direction
	 */
    public void setDirection(double direction) {
        this.direction = direction;
    }

    /**
	 * Returns whether the target was stopped
	 * 
	 * @return Boolean true or false
	 */
    public boolean isStopped() {
        return stopped;
    }

    /**
	 * Sets whether the target was stopped
	 * 
	 * @param stopped Boolean true or false
	 */
    public void setStopped(boolean stopped) {
        this.stopped = stopped;
    }

    /**
	 * Returns true if this dataobject is to be included in the output path.
	 * 
	 * @return Boolean true or false
	 */
    public boolean isIncludeInPath() {
        return includeInPath;
    }

    /**
	 * Sets whether this dataobject is to be included in the output path.
	 * 
	 * @param includeInPath Boolean true or false
	 */
    public void setIncludeInPath(boolean includeInPath) {
        this.includeInPath = includeInPath;
    }

    /**
	 * Gets the kmh speed
	 * 
	 * @return The kmh speed
	 */
    public double getKmhspeed() {
        return kmhspeed;
    }

    /**
	 * Gets the kmh speed
	 * 
	 * @param kmhspeed
	 *            The kmh speed
	 */
    public void setKmhspeed(double kmhspeed) {
        this.kmhspeed = kmhspeed;
    }

    /**
	 * Gets the altitude
	 * 
	 * @return The altitude
	 */
    public double getAltitude() {
        return altitude;
    }

    /**
	 * Sets the altitude
	 * 
	 * @param altitude
	 *            The altitude
	 */
    public void setAltitude(double altitude) {
        this.altitude = altitude;
    }

    /**
	 * Gets the HDOP value. The Horizontal Depreciation of Precision
	 * 
	 * @return The HDOP value
	 */
    public double getHdop() {
        return hdop;
    }

    /**
	 * Sets the HDOP value. The Horizontal Depreciation of Precision
	 * 
	 * @param hdop
	 *            The HDOP value
	 */
    public void setHdop(double hdop) {
        this.hdop = hdop;
    }

    /**
	 * Gets the PDOP value. The Position Depreciation of Precision
	 * 
	 * @return The PDOP value
	 */
    public double getPdop() {
        return pdop;
    }

    /**
	 * Sets the PDOP value. The Position Depreciation of Precision
	 * 
	 * @param pdop The PDOP value
	 */
    public void setPdop(double pdop) {
        this.pdop = pdop;
    }

    /**
	 * Gets the VDOP value. The Vertical Depreciation of Precision
	 * 
	 * @return The VDOP value
	 */
    public double getVdop() {
        return vdop;
    }

    /**
	 * Sets the VDOP value. The Vertical Depreciation of Precision
	 * 
	 * @param vdop The VDOP value
	 */
    public void setVdop(double vdop) {
        this.vdop = vdop;
    }

    /**
	 * Returns the AudioData object associated with this NmeaData object.
	 * 
	 * @return audio field
	 * @see AudioData
	 */
    public AudioData getAudio() {
        return audio;
    }

    /**
	 * Sets the AudioData object associated with this NmeaData object.
	 * 
	 * @param audio field
	 * @see AudioData
	 */
    public void setAudio(AudioData audio) {
        this.audio = audio;
    }

    /**
	 * Returns the PictureData object associated with this NmeaData object.
	 * 
	 * @return PictureData[] 
	 * @see PictureData
	 */
    public PictureData[] getPictures() {
        return pictures;
    }

    /**
	 * Sets the PictureData object associated with this NmeaData object.
	 * 
	 * @param pictures field
	 * @see PictureData
	 */
    public void setPictures(PictureData[] pictures) {
        this.pictures = pictures;
    }
}

